<?php

namespace app\common\model\Hotel;

use think\Model;

/**
 * 客户模型
 */
class Guest extends Model
{
  //标记当前模型操作来自哪个表
  protected $name = 'hotel_guest';


  // 增加获取器字段选项
  protected $append = [
    'sex_text', //性别
  ];

  // 性别字段
  public function getSexTextAttr($value, $data)
  {
    $sexlist = [0 => '女', 1 => '男'];

    $gender = isset($data['gender']) ? $data['gender'] : '';

    if ($gender >= '0') {
      return $sexlist[$gender];
    }
    return;
  }
}
